package com.test.demo1.controller;

import com.test.demo1.entity.Attachment;
import com.test.demo1.service.AttachmentService;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import javax.annotation.Resource;

/**
 * 
 * @author huishao
 * @since 2022-11-03 09:30:14
 */
@RestController
@RequestMapping("attachment")
public class AttachmentController {
    /**
     * 注入 AttachmentController 服务对象
     */
    @Resource
    private AttachmentService attachmentService;

    @GetMapping("listAll")
    public List<Attachment> listAll(){
        return (attachmentService).selectAll();
    }
    
    @GetMapping("/{id}")
    public Attachment getById(@PathVariable("id") String id){
        return (attachmentService).getById(id);
    }

    @PostMapping()
    public int insert(@RequestBody Attachment attachment){
        return (attachmentService).add(attachment);
    }
        
    @PutMapping()
    public int update(@RequestBody Attachment attachment){
        return (attachmentService).update(attachment);
    }
    
    // 删除方法自己写 ！ 


}

